<?
include("session.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../../../webkit/utils/jquery.js"></script>
<script type="text/javascript" src="../../../webkit/grid/import.js"></script>
</head>
<body bgccolor="#f4f4f4" style="margin:0px;overflow-x:hidden">

<table width=100% height=100% cellspacing=0 cellpadding=0>
	<td>
		<table id="flex1" style="display:none"></table>
	</td>
	</form>
	</tr>
</table>


<script>
	$("#flex1").flexigrid({
		url: 'task_query.php?action=list_back&task_id=<?echo $_GET['task_id']?>',
		dataType: 'json',
		colModel : [
			{display: '座席工号', name : 'a', width : 150, sortable : false, align: 'center'},
			{display: '未呼条数', name : 'a', width : 150, sortable : false, align: 'center'},
			{display: '回收操作', name : 'call_count', width : 150, sortable : true, align: 'center'}
			],
		buttons : [
			{name: '批量全部回收', bclass: 'other', onpress : set_back_all}
		],
		async : true,
		usepager: true,
		useRp: true,
		rp: 8,
		showTableToggleBtn: false,
		width: 'auto',
		height: 130,
		resizable : false,
		singleSelect : true
	});

	var task_id = <?echo $_GET['task_id']?>;

	function set_back(task_id , agent_id) {
		//alert(task_id+","+agent_id);
		//return; 
		var limit = $("#set_back_"+task_id+"_"+agent_id).val();
		if(confirm("确认要回收工号[ "+agent_id+" ]的[ "+ limit +" ]条未呼记录吗?")) {
			$.get("task_query.php?action=set_back&task_id="+task_id+"&agent_id="+agent_id+"&limit="+limit, function(data){
				if(data == "ok") {
					alert("操作成功！");
					$('#flex1').flexReload();
					parent.refreshGrid();
				} else {
					alert(data);	
				}
			});
		}
	}

	function set_back_all() {
		if(confirm("确认要全部回收此任务的未呼记录吗?")) {
			$.get("task_query.php?action=set_back_all&task_id="+task_id, function(data){
				if(data == "ok") {
					alert("操作成功！");
					$('#flex1').flexReload();
					parent.refreshGrid();
				} else {
					alert(data);	
				}
			});
		}
	}


</script>
</body>
</html>